/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package tallerfinal.util.distributions;

import tallerfinal.util.distributions.factory.GeneratorsFactory;
import tallerfinal.util.enums.DistributionsName;

/**
 *
 * @author ricardo
 */
public class WeibullGenerator extends Generator<Double> {

    static {
        GeneratorsFactory.getInstance().registerProduct(DistributionsName.WEIBULL, WeibullGenerator.class);
    }
    private double scale;
    private double shape;

    public WeibullGenerator(double scale, double shape) {
        this.scale = scale;
        this.shape = shape;
    }

    @Override
    public Double generate() {
        return scale * Math.pow(-Math.log(1 - generator.nextDouble()), 1 / shape);
    }
}
